<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OrangeCNC - ARISC firmware documentation: mod_msg.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">OrangeCNC - ARISC firmware documentation
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('mod__msg_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">mod_msg.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="mod__msg_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#ifndef _MOD_MSG_H</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#define _MOD_MSG_H</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#af3308b172a869d3042b4c4d1cafca7ec">   18</a></span>&#160;<span class="preprocessor">#define SRAM_A2_SIZE            (48*1024)</span></div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a32db712b349f9407972e7432c54ebb16">   19</a></span>&#160;<span class="preprocessor">#define SRAM_A2_ADDR            0x00000000 </span></div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a50896bb5fb2262810a3c8e647136d557">   20</a></span>&#160;<span class="preprocessor">#define ARISC_CONF_SIZE         2048</span></div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a744176a7a7d6b742df6bb6d0454a4a21">   21</a></span>&#160;<span class="preprocessor">#define ARISC_CONF_ADDR         (SRAM_A2_ADDR + SRAM_A2_SIZE - ARISC_CONF_SIZE)</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#ac0efb4c621de867a9be68caf45dcad81">   23</a></span>&#160;<span class="preprocessor">#define MSG_BLOCK_SIZE          4096</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#affeee331fb954fde3694aa52e2acb517">   24</a></span>&#160;<span class="preprocessor">#define MSG_BLOCK_ADDR          (ARISC_CONF_ADDR - MSG_BLOCK_SIZE)</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a12e05bac48f471021950433d0f3b2d28">   26</a></span>&#160;<span class="preprocessor">#define MSG_CPU_BLOCK_SIZE      2048</span></div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a786c41298ca265cde17ee26e4745edd4">   27</a></span>&#160;<span class="preprocessor">#define MSG_ARISC_BLOCK_ADDR    (MSG_BLOCK_ADDR + 0)</span></div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a2bd61a93d0306c8d9496ffe245549c81">   28</a></span>&#160;<span class="preprocessor">#define MSG_ARM_BLOCK_ADDR      (MSG_BLOCK_ADDR + MSG_CPU_BLOCK_SIZE)</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#aaab950341cb55d90ccd23c63b1c1524f">   30</a></span>&#160;<span class="preprocessor">#define MSG_MAX_CNT             32</span></div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a2ad9de7ccad1dc3102460a8090f17ed0">   31</a></span>&#160;<span class="preprocessor">#define MSG_MAX_LEN             (MSG_CPU_BLOCK_SIZE / MSG_MAX_CNT)</span></div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a1f15293623649a310a7c68ff240f9647">   32</a></span>&#160;<span class="preprocessor">#define MSG_LEN                 (MSG_MAX_LEN - 4)</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a098b85c4d7a37959d03e15cc83790fe8">   34</a></span>&#160;<span class="preprocessor">#define MSG_RECV_CALLBACK_CNT   256</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor">#pragma pack(push, 1)</span></div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="structmsg__t.html">   40</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structmsg__t.html">msg_t</a></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;{</div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="structmsg__t.html#a4c4fc7e394bc4eec59d60e3590a1bc98">   42</a></span>&#160;    uint8_t <a class="code" href="structmsg__t.html#a4c4fc7e394bc4eec59d60e3590a1bc98">unread</a>;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structmsg__t.html#ae6842f8b779e076afaa64556f1d0706a">   43</a></span>&#160;    uint8_t <a class="code" href="structmsg__t.html#ae6842f8b779e076afaa64556f1d0706a">locked</a>; <span class="comment">// actually not used at this moment</span></div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="structmsg__t.html#a1d127017fb298b889f4ba24752d08b8e">   44</a></span>&#160;    uint8_t <a class="code" href="structmsg__t.html#a1d127017fb298b889f4ba24752d08b8e">type</a>;</div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structmsg__t.html#ab2b3adeb2a67e656ff030b56727fd0ac">   45</a></span>&#160;    uint8_t <a class="code" href="structmsg__t.html#ab2b3adeb2a67e656ff030b56727fd0ac">length</a>;</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="structmsg__t.html#a8f02bea0351df54ac6794cd4bc91f44e">   46</a></span>&#160;    uint8_t <a class="code" href="structmsg__t.html#a8f02bea0351df54ac6794cd4bc91f44e">msg</a>[<a class="code" href="mod__msg_8h.html#a1f15293623649a310a7c68ff240f9647">MSG_LEN</a>];</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;};</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">#pragma pack(pop)</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="mod__msg_8h.html#a374ff7872dc0e70bbc8b4c5273b2c703">   50</a></span>&#160;<span class="keyword">typedef</span> int32_t (*<a class="code" href="mod__msg_8h.html#a374ff7872dc0e70bbc8b4c5273b2c703">msg_recv_func_t</a>)(uint8_t, uint8_t*, uint8_t);</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="structu32__10__t.html#a8ab12c9bfff508004e9d0f9a5c89c0d2">   52</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span>{ uint32_t v[10]; } <a class="code" href="structu32__10__t.html">u32_10_t</a>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">// export public methods</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="keywordtype">void</span> <a class="code" href="mod__msg_8h.html#a577ee695bade6a55efa4c5a7d9866a74">msg_module_init</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keywordtype">void</span> <a class="code" href="mod__msg_8h.html#ac7611d9252e22be0140ad3beb46eb8a2">msg_module_base_thread</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;int8_t <a class="code" href="mod__msg_8h.html#aad162e5eb1e3fb9806dc50c01ecb7d70">msg_send</a>(uint8_t <a class="code" href="structmsg__t.html#a1d127017fb298b889f4ba24752d08b8e">type</a>, uint8_t * <a class="code" href="structmsg__t.html#a8f02bea0351df54ac6794cd4bc91f44e">msg</a>, uint8_t <a class="code" href="structmsg__t.html#ab2b3adeb2a67e656ff030b56727fd0ac">length</a>);</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="keywordtype">void</span> <a class="code" href="mod__msg_8h.html#a51c02043fa74dd30c73670ca0c066727">msg_recv_callback_add</a>(uint8_t msg_type, <a class="code" href="mod__msg_8h.html#a374ff7872dc0e70bbc8b4c5273b2c703">msg_recv_func_t</a> func);</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="keywordtype">void</span> <a class="code" href="mod__msg_8h.html#a99224966c8fcbf2162a8949640e99684">msg_recv_callback_remove</a>(uint8_t msg_type);</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="mod__msg_8h_html_a51c02043fa74dd30c73670ca0c066727"><div class="ttname"><a href="mod__msg_8h.html#a51c02043fa74dd30c73670ca0c066727">msg_recv_callback_add</a></div><div class="ttdeci">void msg_recv_callback_add(uint8_t msg_type, msg_recv_func_t func)</div><div class="ttdoc">add the function to the list of &quot;message received callbacks&quot; </div><div class="ttdef"><b>Definition:</b> mod_msg.c:136</div></div>
<div class="ttc" id="structmsg__t_html_a1d127017fb298b889f4ba24752d08b8e"><div class="ttname"><a href="structmsg__t.html#a1d127017fb298b889f4ba24752d08b8e">msg_t::type</a></div><div class="ttdeci">uint8_t type</div><div class="ttdef"><b>Definition:</b> mod_msg.h:44</div></div>
<div class="ttc" id="mod__msg_8h_html_a1f15293623649a310a7c68ff240f9647"><div class="ttname"><a href="mod__msg_8h.html#a1f15293623649a310a7c68ff240f9647">MSG_LEN</a></div><div class="ttdeci">#define MSG_LEN</div><div class="ttdef"><b>Definition:</b> mod_msg.h:32</div></div>
<div class="ttc" id="structu32__10__t_html"><div class="ttname"><a href="structu32__10__t.html">u32_10_t</a></div><div class="ttdef"><b>Definition:</b> mod_msg.h:52</div></div>
<div class="ttc" id="structmsg__t_html_ae6842f8b779e076afaa64556f1d0706a"><div class="ttname"><a href="structmsg__t.html#ae6842f8b779e076afaa64556f1d0706a">msg_t::locked</a></div><div class="ttdeci">uint8_t locked</div><div class="ttdef"><b>Definition:</b> mod_msg.h:43</div></div>
<div class="ttc" id="structmsg__t_html_ab2b3adeb2a67e656ff030b56727fd0ac"><div class="ttname"><a href="structmsg__t.html#ab2b3adeb2a67e656ff030b56727fd0ac">msg_t::length</a></div><div class="ttdeci">uint8_t length</div><div class="ttdef"><b>Definition:</b> mod_msg.h:45</div></div>
<div class="ttc" id="mod__msg_8h_html_aad162e5eb1e3fb9806dc50c01ecb7d70"><div class="ttname"><a href="mod__msg_8h.html#aad162e5eb1e3fb9806dc50c01ecb7d70">msg_send</a></div><div class="ttdeci">int8_t msg_send(uint8_t type, uint8_t *msg, uint8_t length)</div><div class="ttdoc">send a message to the ARM cpu </div><div class="ttdef"><b>Definition:</b> mod_msg.c:88</div></div>
<div class="ttc" id="mod__msg_8h_html_a374ff7872dc0e70bbc8b4c5273b2c703"><div class="ttname"><a href="mod__msg_8h.html#a374ff7872dc0e70bbc8b4c5273b2c703">msg_recv_func_t</a></div><div class="ttdeci">int32_t(* msg_recv_func_t)(uint8_t, uint8_t *, uint8_t)</div><div class="ttdef"><b>Definition:</b> mod_msg.h:50</div></div>
<div class="ttc" id="structmsg__t_html"><div class="ttname"><a href="structmsg__t.html">msg_t</a></div><div class="ttdef"><b>Definition:</b> mod_msg.h:40</div></div>
<div class="ttc" id="mod__msg_8h_html_a577ee695bade6a55efa4c5a7d9866a74"><div class="ttname"><a href="mod__msg_8h.html#a577ee695bade6a55efa4c5a7d9866a74">msg_module_init</a></div><div class="ttdeci">void msg_module_init(void)</div><div class="ttdoc">module init </div><div class="ttdef"><b>Definition:</b> mod_msg.c:33</div></div>
<div class="ttc" id="structmsg__t_html_a8f02bea0351df54ac6794cd4bc91f44e"><div class="ttname"><a href="structmsg__t.html#a8f02bea0351df54ac6794cd4bc91f44e">msg_t::msg</a></div><div class="ttdeci">uint8_t msg[MSG_LEN]</div><div class="ttdef"><b>Definition:</b> mod_msg.h:46</div></div>
<div class="ttc" id="mod__msg_8h_html_ac7611d9252e22be0140ad3beb46eb8a2"><div class="ttname"><a href="mod__msg_8h.html#ac7611d9252e22be0140ad3beb46eb8a2">msg_module_base_thread</a></div><div class="ttdeci">void msg_module_base_thread(void)</div><div class="ttdoc">module base thread </div><div class="ttdef"><b>Definition:</b> mod_msg.c:53</div></div>
<div class="ttc" id="structmsg__t_html_a4c4fc7e394bc4eec59d60e3590a1bc98"><div class="ttname"><a href="structmsg__t.html#a4c4fc7e394bc4eec59d60e3590a1bc98">msg_t::unread</a></div><div class="ttdeci">uint8_t unread</div><div class="ttdef"><b>Definition:</b> mod_msg.h:42</div></div>
<div class="ttc" id="mod__msg_8h_html_a99224966c8fcbf2162a8949640e99684"><div class="ttname"><a href="mod__msg_8h.html#a99224966c8fcbf2162a8949640e99684">msg_recv_callback_remove</a></div><div class="ttdeci">void msg_recv_callback_remove(uint8_t msg_type)</div><div class="ttdoc">remove the callback function from the list of &quot;message received callbacks&quot; </div><div class="ttdef"><b>Definition:</b> mod_msg.c:147</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="mod__msg_8h.html">mod_msg.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
